package cn.achao.csr.chat.controller;

import cn.achao.csr.api.model.req.BatchUserInfoReq;
import cn.achao.csr.api.model.resp.UserInfoResp;
import cn.achao.csr.base.resp.R;
import cn.achao.csr.chat.service.ChatUserService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * @Author: achao
 **/
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/user")
public class ChatUserController {

    private final ChatUserService userService;

    /**
     * 用户聚合信息
     * @param req
     * @return
     */
    @PostMapping("/userInfo/batch")
    public R<List<UserInfoResp>> getSummeryUserInfo(@Valid @RequestBody BatchUserInfoReq req) {
        return R.ok(userService.getSummeryUserInfo(req));
    }
}
